package org.beanutopia.function;

/**
 * @author ymeymann
 * @since Oct 30, 2007 11:38:48 PM
*/
public class SubtypePredicate<T> extends TypePredicate<T> {

  public SubtypePredicate(Class<? extends T> c) {
    super(c);
  }

  public boolean apply(T o) {
    if (o instanceof Class) 
      return (klass.isAssignableFrom((Class)o));
    else
      return (o != null && klass.isAssignableFrom(o.getClass()));
  }

}
